package DHBW.BT;

/**
 * This class extends the class BluetoothFrame. In addition to data array
 * the IDs are assigned to their meaning. Additionally get-methods for the
 * data are provided.
 * @author baumlndn
 *
 */
public class PedelecFrame extends BluetoothFrame {

	public static final int MAX_USED_ID 	= 4;
	
	public static final int ID_ID 			= 0;
	public static final int ID_RPM			= 1;
	public static final int ID_CURRENT		= 2;
	public static final int ID_VOLTAGE		= 3;
	public static final int ID_TEMPERATURE	= 4;
	
	public PedelecFrame() {
		// TODO Auto-generated constructor stub
	}

	public PedelecFrame(byte[][] temp_data) {
		super(temp_data);
		// TODO Auto-generated constructor stub
	}

	/**
	 * The function returns the counter value of the dataset
	 * @return ID of dataset (0-99)
	 */
	public int id() {
		return (int) ((this.getData(ID_ID, 1)[0] & 0xFE)>>1);
	}

	/**
	 * The function returns the voltage
	 * @return voltage
	 */
	public int voltage() {
		return (int) this.getData(ID_VOLTAGE, 1)[0];
	}
	
	/**
	 * The function returns the current
	 * @return current
	 */
	public int current() {
		return (int) this.getData(ID_CURRENT, 1)[0];
	}
	
	/**
	 * The function returns the temperature
	 * @return temperature
	 */
	public int temperature() {
		return (int) this.getData(ID_TEMPERATURE, 1)[0];
	}
	
	/**
	 * The function returns the RPM
	 * @return RPM
	 */
	public int rpm() {
		return (int) this.getData(ID_RPM, 1)[0];
	}
	
	/**
	 * Returns to highest used id
	 * @return highest id
	 */
	public int max_id() {
		return MAX_USED_ID;
	}
}
